package com.example.core.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;


/****
 *
 * 时间筛选枚举类型
 */
public enum TimeEnums implements SysEnum {

    WEEK("本周", "1"), MONTH("本月", "2"), YEAR("本年", "3"), ALL("所有", "4");

    @JsonValue
    private String label;

    @EnumValue
    private String value;

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    @Override
    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    TimeEnums(String label, String value) {
        this.label = label;
        this.value = value;
    }

    public static TimeEnums valueBy(String val) {
        for (TimeEnums timeEnums : TimeEnums.values()) {
            if (timeEnums.getValue().equalsIgnoreCase(val)) {
                return timeEnums;
            }
        }
        return null;
    }
}
